package com.gwtjs.icustom.utils;

public class SystemVersionUtil {

    static public String getOSName()
    {
        String osName = "windows" ;
        String os = System.getProperty("os.name");
        //Windows操作系统
        if (os != null && os.toLowerCase().startsWith("windows")) {
            osName = "windows" ;
            System.out.println(String.format("当前系统版本是:%s", os));
        } else if (os != null && os.toLowerCase().startsWith("linux")) {//Linux操作系统
            osName = "linux" ;
            System.out.println(String.format("当前系统版本是:%s", os));
        } else { //其它操作系统
            osName = "other" ;
            System.out.println(String.format("当前系统版本是:%s", os));
        }
        return osName;
    }
    
    /**
     * is linux system
     * @return
     */
    static public boolean isLinux()
    {
    	boolean flag = true;
    	String osName = getOSName();
    	if(!"linux".equals(osName)) {
    		flag = false;
    	}
    	
    	return flag;
    }
    
    /**
     * is linux system
     * @return
     */
    static public boolean isWindows()
    {
    	boolean flag = true;
    	String osName = getOSName();
    	if(!"windows".equals(osName)) {
    		flag = false;
    	}
    	
    	return flag;
    }
    
}
